package jvmTest;

/**
 * @Author G_Y
 * @Date 2021/2/22 9:34
 * @Description: // TODO
 **/
public class RuntimeConstantPoolOOM2 {
    // HotSpot JDK7 及以上
    public static void main(String[] args) {
        String str1 = new StringBuilder("计算机").append("软件").toString();
        System.out.println(str1.intern() == str1);// true
        String str2 = new StringBuilder("ja").append("va").toString();
        System.out.println(str2.intern() == str2);// false

        String str3 = new StringBuilder("Cla").append("ss").toString();
        System.out.println(str3.intern() == str3);// true
    }
}
